function httpPost($sURL,$aPostVars)
{
$srv_ip = '域名';
$srv_port = 80;
$url = $sURL;
$fp = '';
$resp_str = '';
$errno = 0;
$errstr = '';
$timeout = 300;
$post_str = $aPostVars;
$fp = fsockopen($srv_ip,$srv_port,$errno,$errstr,$timeout);
if (!$fp)
{
echo('fp fail');
}
$content_length = strlen($post_str);
$post_header = "POST $url HTTP/1.1\r\n";
$post_header .= "Content-Type:application/x-www-form-urlencoded\r\n";
$post_header .= "User-Agent: MSIE\r\n";
$post_header .= "Host: ".$srv_ip."\r\n";;
$post_header .= "Content-Length: ".$content_length."\r\n";
$post_header .= "Connection: close\r\n\r\n";
$post_header .= $post_str."\r\n\r\n";
fwrite($fp,$post_header);
$inheader = 1;
while (!feof($fp)) {
$line = fgets($fp,1024);
if ($inheader && ($line == "\n" || $line == "\r\n")) {
$inheader = 0;
}
if ($inheader == 0) {
echo $line;
}
}
}
$content = "您的注册验证码为8268,该验证码10分钟内有效。如非本人操作请忽略此短信!【浪驰软件】";
$content = iconv("utf-8","gb2312//IGNORE",$content);
httpPost("/LANZGateway/DirectSendSMSs.asp","UserID=999999&Account=lanz2016
&Password=735FF0028B7831D2783DD7EE98E3095DB94A1D64&Content=$content&Phones=11111111111&ReturnXJ=1");
|
XML:
<?xml version="1.0" encoding="GB2312"?>
<LANZ_ROOT>
<ErrorNum>0</ErrorNum>
<JobID>2321313130</JobID>
<PhonesSend>98</PhonesSend>
<ErrPhones>13855556666;13611112222</ErrPhones>
<DeductionSMSs>1000</DeductionSMSs>
</LANZ_ROOT>
JSON:
{
"LANZ_ROOT": {
"ErrorNum": "0",
"JobID": "2321313130",
"PhonesSend": "98",
"ErrPhones": "13855556666;13611112222",
"DeductionSMSs": "1000"
}
}
|